package com.zhdl.modules.conveyerbelt.service.impl;

import cn.hutool.json.JSONUtil;
import com.project.common.util.ByteHelper;
import com.zhdl.common.ytools.IntToHexUtil;
import com.zhdl.hardware.plc.siemens.repository.impl.SiemensPortCmdHandleDaoImpl;
import com.zhdl.hardware.plc.siemens.service.SiemensCmdSendService;
import com.zhdl.modules.conveyerbelt.service.ConveyerBeltService;
import com.zhdl.modules.conveyerbelt.web.resp.MemoryInfo;
import com.zhdl.modules.conveyerbelt.web.resp.PlcMutexInfo;
import com.zhdl.modules.conveyerbelt.web.resp.PlcWarnInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;

@Slf4j
@Service
public class ConveyerBeltServiceImpl implements ConveyerBeltService {

    public static MemoryInfo memoryInfo = new MemoryInfo();
    private final int timeout;
    private final String plcIp;
    @Resource
    public SiemensCmdSendService siemensCmdSendService;
    @Resource
    public ThreadPoolTaskScheduler taskScheduler1;
    /*90*/
    public String siemensValue = "000000000000000000000000000000000000000000000" +
            "000000000000000000000000000000000000000000000";
    public String startValue = "0000000000000000";
    public String motorValue = "0000000000000000";
    /**
     * 线程管理
     */
    Map<String, ScheduledFuture<?>> mapSF = new HashMap<>();
    Map<Integer, String> maps = new ConcurrentHashMap<>();
    @Resource
    private SiemensPortCmdHandleDaoImpl siemensPortCmdHandleDao;

    {
        timeout = 1000;
        plcIp = "192.168.1.10:502";
//        plcIp = "127.0.0.1:502";
    }

    /**
     * 将byte转换为一个长度为8的byte数组，数组每个值代表bit
     */
    public static Byte[] getBitArray(byte b) {
        Byte[] array = new Byte[8];
        for (int i = 7; i >= 0; i--) {
            array[i] = (byte) (b & 1);
            b = (byte) (b >> 1);
        }
        return array;
    }

    /**
     * 写入plc操作信息
     *
     * @param address 地址
     * @param bit     位
     * @param value   值
     */
    @Override
    public void writePlcWarnInfo(int address, int bit, int value) {
        String before = "00000000";
        String after = "00000000";
        int number = (address - 354) * 8;
        if (address % 2 == 0) {
            before = siemensValue.substring(number, number + 8);
            after = siemensValue.substring(number + 8, number + 16);
        } else {
            before = siemensValue.substring(number - 8, number);
            after = siemensValue.substring(number, number + 8);
        }

        StringBuffer stringBufferBefore = new StringBuffer(before);
        StringBuffer stringBufferAfter = new StringBuffer(after);

        int position = 8 - bit;
        if (address % 2 == 0) {
            if (value == 0) {
                stringBufferBefore.replace(position - 1, position, "0");
            } else {
                stringBufferBefore.replace(position - 1, position, "1");
            }
        } else {
            if (value == 0) {
                stringBufferAfter.replace(position - 1, position, "0");
            } else {
                stringBufferAfter.replace(position - 1, position, "1");
            }
        }

        String cmd = stringBufferBefore.toString() + stringBufferAfter;

        log.info("--->" + cmd);

        int i = Integer.parseInt(cmd, 2);
        String s = IntToHexUtil.shortToHex(i);
        String addr = IntToHexUtil.shortToHex(address / 2);
        siemensCmdSendService.siemensWriteValue(plcIp, addr, s);
    }

    @Override
    public void writePlcStartInfo(int bit, int value) {
        StringBuffer stringBufferStart = new StringBuffer(startValue);

        if (bit >= 0 && bit <= 7) {
            bit = 8 - bit;
        } else {
            bit = 24 - bit;
        }

        if (value == 0) {
            stringBufferStart.replace(bit - 1, bit, "0");
        } else {
            stringBufferStart.replace(bit - 1, bit, "1");
        }


        int i = Integer.parseInt(stringBufferStart.toString(), 2);
        String s = IntToHexUtil.shortToHex(i);
        String addr = IntToHexUtil.shortToHex(0);
        siemensCmdSendService.siemensWriteValue(plcIp, addr, s);
    }

    @Override
    public void readPlcStartInfo() {
        siemensCmdSendService.siemensAddressValue(plcIp, "0000", 1, timeout, s -> {
            int dec = Integer.parseInt(s, 16);
            startValue = Integer.toBinaryString(dec);

            byte[] bytes = ByteHelper.hex2byte(s);
            List<Byte> ioList = new ArrayList<>();
            for (byte b : bytes) {
                Byte[] bitArray = getBitArray(b);
                List<Byte> listB = Arrays.asList(bitArray);
                Collections.reverse(listB);
                ioList.addAll(listB);
            }
//                    String jsonStr = JSONUtil.toJsonStr(ioList);
            StringBuilder s11 = new StringBuilder();
            for (Byte b : ioList) {
                s11.append(b);
            }
            memoryInfo.setStartValue(s11.toString());
        });
    }

    /**
     * 读取电机是否到位
     */
    public void readPlcMotorStatus() {
        siemensCmdSendService.siemensAddressValue(plcIp, "00B1", 10, timeout, s -> {
            StringBuilder temp = new StringBuilder();
            for (int i = 0; i < s.length(); i++) {
                if (i % 4 == 0) {
                    int dec = Integer.parseInt(s.substring(i, i + 4), 16);
                    temp.append(Integer.toBinaryString(dec));
                }
            }
            motorValue = temp.toString();
        });
    }

    /**
     * 读取关键寄存器保存 - 控制类数据
     */
    @Override
    public void readPlcAction354To364() {
        siemensCmdSendService.siemensAddressValue(plcIp, "00B1", 10, timeout, s -> {
            StringBuilder temp = new StringBuilder();
            for (int i = 0; i < s.length(); i++) {
                if (i % 4 == 0) {
                    int dec = Integer.parseInt(s.substring(i, i + 4), 16);
                    String binaryString = Integer.toBinaryString(dec);
                    String number = "";
                    if (binaryString.length() < 16) {
                        for (int i1 = 0; i1 < 16 - binaryString.length(); i1++) {
                            number += "0";
                        }
                        binaryString = number + binaryString;
                    }
                    temp.append(binaryString);
                }
            }
            siemensValue = temp.toString();
        });
    }

    /**
     * 读取开关量
     */
    @Override
    public void readPlcMutexInfo408To444() {
        siemensCmdSendService.siemensAddressValue(plcIp, "00CC", 18, timeout, s -> {
            log.info("readPlcWarn 408To444 原始数据--> " + s);

            byte[] bytes = ByteHelper.hex2byte(s);

            log.info("readPlcWarn 408To444 字节数据--> " + Arrays.toString(bytes));

            /* 获取当前指令返回的数据 */
            /* 对返回的数据进行处理 - 每八位进行高低位反转 */
            List<Byte> ioList = new ArrayList<>();
            for (byte b : bytes) {
                Byte[] bitArray = getBitArray(b);
                List<Byte> listB = Arrays.asList(bitArray);
                Collections.reverse(listB);
                ioList.addAll(listB);
            }

            log.info("readPlcWarn 408To444 反转数据--> " + ioList);
            String jsonStr = JSONUtil.toJsonStr(ioList);
            memoryInfo.setMutexInfos(new PlcMutexInfo(jsonStr));
        });
    }

    /**
     * 读取报警信息
     */
    @Override
    public void readPlcWarnInfo336To402() {

        siemensCmdSendService.siemensAddressValue(plcIp, "00BA", 18, timeout, s -> {

            /* 00 00 00 00 00 27 01 03 24 00 a2 6a a6 0a 00 00 00 00 00 00 00 00 00 00 00
               00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
            /*  00 a2 6a a6 0a 00 00 00 00 00 00 00 00 00 00 00 00 00000000000000000000000000000000000000 */
            /* [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] */
            log.info("readPlcWarn 372To408 原始数据--> " + s);

            byte[] bytes = ByteHelper.hex2byte(s);

            log.info("readPlcWarn 372To408 字节数据--> " + Arrays.toString(bytes));

            /* 获取当前指令返回的数据 */
            /* 对返回的数据进行处理 - 每八位进行高低位反转 */
            List<Byte> ioList = new ArrayList<>();
            for (byte b : bytes) {
                Byte[] bitArray = getBitArray(b);
                List<Byte> listB = Arrays.asList(bitArray);
                Collections.reverse(listB);
                ioList.addAll(listB);
            }
            log.info("readPlcWarn 372To408 反转数据--> " + ioList);

            List<PlcWarnInfo> warnList = new ArrayList<>();
            for (int i = 0; i < ioList.size(); i++) {
                if (ioList.get(i) == 1) {
                    String s1 = maps.get(i);
                    if (s1 != null) {
                        warnList.add(new PlcWarnInfo(s1));
                    }
                    log.info(s1);
                }
            }
            memoryInfo.setWarnList(warnList);
        });
    }

    @Override
    public void initMaps() {

        siemensPortCmdHandleDao.addPort(plcIp);

        readPlcAction354To364();

        readPlcWarnInfo336To402();

        readPlcMutexInfo408To444();

        readPlcStartInfo();


        /*
            轴报警_1-11
         */
        maps.put(0, "轴1_2 伺服未使能 -->");
        maps.put(1, "轴1_2 轴错误 -->");
        maps.put(2, "轴1_2 轴故障_查看报警代码 -->");
        maps.put(3, "轴1_2 轴报警_回下降位光电不亮 -->");

        maps.put(16, "轴z3_4 伺服未使能 -->");
        maps.put(17, "轴z3_4 轴错误 -->");
        maps.put(18, "轴z3_4 轴故障_查看报警代码 -->");
        maps.put(19, "轴z3_4 轴报警_回下降位光电不亮 -->");

        maps.put(32, "轴5_6 伺服未使能 -->");
        maps.put(33, "轴5_6 轴错误 -->");
        maps.put(34, "轴5_6 轴故障_查看报警代码 -->");
        maps.put(35, "轴5_6 轴报警_回下降位光电不亮 -->");

        maps.put(48, "轴7_8 伺服未使能 -->");
        maps.put(49, "轴7_8 轴错误 -->");
        maps.put(50, "轴7_8 轴故障_查看报警代码 -->");
        maps.put(51, "轴7_8 轴报警_回下降位光电不亮 -->");

        maps.put(64, "轴9 伺服未使能 -->");
        maps.put(65, "轴9 轴错误 -->");
        maps.put(66, "轴9 轴故障_查看报警代码 -->");
        maps.put(67, "轴9 轴报警_回下降位光电不亮 -->");

        maps.put(80, "轴10 伺服未使能 -->");
        maps.put(81, "轴10 轴错误 -->");
        maps.put(82, "轴10 轴故障_查看报警代码 -->");
        maps.put(83, "轴10 轴报警_回下降位光电不亮 -->");

        maps.put(96, "轴11 伺服未使能 -->");
        maps.put(97, "轴11 轴错误 -->");
        maps.put(98, "轴11 轴故障_查看报警代码 -->");
        maps.put(99, "轴11 轴报警_回下降位光电不亮 -->");

        maps.put(112, "轴12 伺服未使能 -->");
        maps.put(113, "轴12 轴错误 -->");
        maps.put(114, "轴12 轴故障_查看报警代码 -->");
        maps.put(115, "轴12 轴报警_回下降位光电不亮 -->");

        /*
            超时报警_阻挡
         */
        String outTimeWarn = " 副线体 1-1 上升\n" +
                ",副线体 1-1 下降\n" +
                ",副线体 1-2 上升\n" +
                ",副线体 1-2 下降\n" +
                ",副线体 2-1 上升\n" +
                ",副线体 2-1 下降\n" +
                ",副线体 2-2 上升\n" +
                ",副线体 2-2 下降\n" +
                ",副线体 3-1 上升\n" +
                ",副线体 3-1 下降\n" +
                ",副线体 3-2 上升\n" +
                ",副线体 3-2 下降\n" +
                ",副线体 4-1 上升\n" +
                ",副线体 4-1 下降\n" +
                ",副线体 4-2 上升\n" +
                ",副线体 4-2 下降\n" +
                ",顶升机构 1-1 上升\n" +
                ",顶升机构 1-1 下降\n" +
                ",顶升机构 1-2 上升\n" +
                ",顶升机构 1-2 下降\n" +
                ",顶升机构 2-1 上升\n" +
                ",顶升机构 2-1 下降\n" +
                ",顶升机构 2-2 上升\n" +
                ",顶升机构 2-2 下降\n" +
                ",主线体轻载上升\n" +
                ",主线体轻载下降\n" +
                ",主线体重载 1 上升\n" +
                ",主线体重载 1 下降\n" +
                ",主线体重载 2 上升\n" +
                ",主线体重载 2 下降\n" +
                ",主线体重载 3 上升\n" +
                ",主线体重载 3 下降\n" +
                ",回流线体 1 上升\n" +
                ",回流线体 1 下降\n" +
                ",回流线体 2 上升\n" +
                ",回流线体 2 下降\n";
        String[] split = outTimeWarn.split(",");
        for (int i = 0; i < split.length; i++) {
            maps.put(128 + i, "超时报警_阻挡->" + split[i]);
        }

        String faultAlarm_d = " 副线体 1-1\n" +
                ",副线体 1-2\n" +
                ",副线体 2-1\n" +
                ",副线体 2-2\n" +
                ",副线体 3-1\n" +
                ",副线体 3-2\n" +
                ",副线体 4-1\n" +
                ",副线体 4-2\n" +
                ",顶升机构 1-1\n" +
                ",顶升机构 1-2\n" +
                ",顶升机构 2-1\n" +
                ",顶升机构 2-2\n" +
                ",主线体-1 轻载\n" +
                ",主线体-1 重载\n" +
                ",主线体-2 重载\n" +
                ",主线体-3 重载\n" +
                ",回流线体-1\n" +
                ",回流线体-2\n";

        String[] split1 = faultAlarm_d.split(",");
        for (int i = 0; i < split1.length; i++) {
            maps.put(176 + i, "故障报警_阻挡->" + split1[i]);
        }

        String faultAlarm_m = " 副线体 1-1\n" +
                ",副线体 1-2\n" +
                ",副线体 2-1\n" +
                ",副线体 2-2\n" +
                ",副线体 3-1\n" +
                ",副线体 3-2\n" +
                ",副线体 4-1\n" +
                ",副线体 4-2\n" +
                ",顶升机构 1\n" +
                ",顶升机构 2\n" +
                ",左端升降机\n" +
                ",右端升降机\n" +
                ",主线体-1 轻载\n" +
                ",主线体-2 轻载\n" +
                ",主线体-1 重载\n" +
                ",主线体-2 重载\n" +
                ",主线体-3 重载\n" +
                ",回流线体\n";

        String[] split2 = faultAlarm_m.split(",");
        for (int i = 0; i < split2.length; i++) {
            maps.put(208 + i, "故障报警_输送电机->" + split2[i]);
        }

        String faultAlarm_s = " 副线体 1\n" +
                ",副线体 2\n" +
                ",副线体 3\n" +
                ",副线体 4\n" +
                ",顶升机构 1\n" +
                ",顶升机构 2\n" +
                ",左升降\n" +
                ",右升降\n" +
                ",主线体-1 轻载\n" +
                ",主线体-1 重载\n" +
                ",主线体-2 重载\n" +
                ",主线体-3 重载\n" +
                ",回流线体-1\n" +
                ",回流线体-2\n";

        String[] split3 = faultAlarm_s.split(",");
        for (int i = 0; i < split3.length; i++) {
            maps.put(240 + i, "超时报警_送料->" + split3[i]);
        }

        String faultAlarm_c = " 副线体 1\n" +
                ",副线体 2\n" +
                ",副线体 3\n" +
                ",副线体 4\n" +
                ",顶升机构 1\n" +
                ",顶升机构 2\n" +
                ",左升降\n" +
                ",右升降\n" +
                ",主线体-1 轻载\n" +
                ",主线体-1 重载\n" +
                ",主线体-2 重载\n" +
                ",主线体-3 重载\n" +
                ",回流线体-1\n" +
                ",回流线体-2\n";

        String[] split4 = faultAlarm_c.split(",");
        for (int i = 0; i < split4.length; i++) {
            maps.put(256 + i, "报警_产品未到位->" + split4[i]);
        }

        String scramWarn = ",副线体 1\n" +
                ",副线体 2\n" +
                ",副线体 3\n" +
                ",副线体 4\n" +
                ",顶升机构 1\n" +
                ",顶升机构 2\n" +
                ",左升降\n" +
                ",右升降\n" +
                ",主线体-1 重载左急停\n" +
                ",主线体-1 重载右急停\n" +
                ",主线体-2 重载左急停\n" +
                ",主线体-2 重载右急停\n" +
                ",主线体-3 重载左急停\n" +
                ",主线体-3 重载右急停\n" +
                ",主线体-3 重载\n" +
                ",下层回流线体\n";

        String[] split5 = scramWarn.split(",");
        for (int i = 0; i < split5.length; i++) {
            maps.put(272 + i, "报警_急停中->" + split5[i]);
        }

        //        maps.put(72, "超时报警_阻挡->" + split[0]);
//        maps.put(73, "超时报警_阻挡->" + split[1]);
//        maps.put(74, "超时报警_阻挡->" + split[2]);
//        maps.put(75, "超时报警_阻挡->" + split[3]);
//        maps.put(76, "超时报警_阻挡->" + split[4]);
//        maps.put(77, "超时报警_阻挡->" + split[5]);
//        maps.put(78, "超时报警_阻挡->" + split[6]);
//        maps.put(79, "超时报警_阻挡->" + split[7]);
//        maps.put(80, "超时报警_阻挡->" + split[8]);
//        maps.put(81, "超时报警_阻挡->" + split[9]);
//        maps.put(82, "超时报警_阻挡->" + split[10]);
//        maps.put(83, "超时报警_阻挡->" + split[11]);
//        maps.put(84, "超时报警_阻挡->" + split[12]);
//        maps.put(85, "超时报警_阻挡->" + split[13]);
//        maps.put(86, "超时报警_阻挡->" + split[14]);
//        maps.put(87, "超时报警_阻挡->" + split[15]);
//        maps.put(88, "超时报警_阻挡->" + split[16]);
//        maps.put(89, "超时报警_阻挡->" + split[17]);
//        maps.put(90, "超时报警_阻挡->" + split[18]);
//        maps.put(91, "超时报警_阻挡->" + split[19]);
//        maps.put(92, "超时报警_阻挡->" + split[20]);
//        maps.put(93, "超时报警_阻挡->" + split[21]);
//        maps.put(94, "超时报警_阻挡->" + split[22]);
//        maps.put(95, "超时报警_阻挡->" + split[23]);
//        maps.put(96, "超时报警_阻挡->" + split[24]);
//        maps.put(97, "超时报警_阻挡->" + split[25]);
//        maps.put(98, "超时报警_阻挡->" + split[26]);
//        maps.put(99, "超时报警_阻挡->" + split[27]);
//        maps.put(100, "超时报警_阻挡->" + split[28]);
//        maps.put(101, "超时报警_阻挡->" + split[29]);
//        maps.put(102, "超时报警_阻挡->" + split[30]);
//        maps.put(103, "超时报警_阻挡->" + split[31]);
//        maps.put(104, "超时报警_阻挡->" + split[32]);
//        maps.put(105, "超时报警_阻挡->" + split[33]);
//        maps.put(106, "超时报警_阻挡->" + split[34]);
//        maps.put(107, "超时报警_阻挡->" + split[35]);

//        maps.put(120, "故障报警_阻挡->" + split1[0]);
//        maps.put(121, "故障报警_阻挡->" + split1[1]);
//        maps.put(122, "故障报警_阻挡->" + split1[2]);
//        maps.put(123, "故障报警_阻挡->" + split1[3]);
//        maps.put(124, "故障报警_阻挡->" + split1[4]);
//        maps.put(125, "故障报警_阻挡->" + split1[5]);
//        maps.put(126, "故障报警_阻挡->" + split1[6]);
//        maps.put(127, "故障报警_阻挡->" + split1[7]);
//        maps.put(128, "故障报警_阻挡->" + split1[8]);
//        maps.put(129, "故障报警_阻挡->" + split1[9]);
//        maps.put(130, "故障报警_阻挡->" + split1[10]);
//        maps.put(131, "故障报警_阻挡->" + split1[11]);
//        maps.put(132, "故障报警_阻挡->" + split1[12]);
//        maps.put(133, "故障报警_阻挡->" + split1[13]);
//        maps.put(134, "故障报警_阻挡->" + split1[14]);
//        maps.put(135, "故障报警_阻挡->" + split1[15]);
//        maps.put(136, "故障报警_阻挡->" + split1[16]);
//        maps.put(137, "故障报警_阻挡->" + split1[17]);

//        maps.put(152, "故障报警_输送电机->" + split2[0]);
//        maps.put(153, "故障报警_输送电机->" + split2[1]);
//        maps.put(154, "故障报警_输送电机->" + split2[2]);
//        maps.put(155, "故障报警_输送电机->" + split2[3]);
//        maps.put(156, "故障报警_输送电机->" + split2[4]);
//        maps.put(157, "故障报警_输送电机->" + split2[5]);
//        maps.put(158, "故障报警_输送电机->" + split2[6]);
//        maps.put(159, "故障报警_输送电机->" + split2[7]);
//        maps.put(160, "故障报警_输送电机->" + split2[8]);
//        maps.put(161, "故障报警_输送电机->" + split2[9]);
//        maps.put(162, "故障报警_输送电机->" + split2[10]);
//        maps.put(163, "故障报警_输送电机->" + split2[11]);
//        maps.put(164, "故障报警_输送电机->" + split2[12]);
//        maps.put(165, "故障报警_输送电机->" + split2[13]);
//        maps.put(166, "故障报警_输送电机->" + split2[14]);
//        maps.put(167, "故障报警_输送电机->" + split2[15]);
//        maps.put(168, "故障报警_输送电机->" + split2[16]);
//        maps.put(169, "故障报警_输送电机->" + split2[17]);

//        maps.put(184, "超时报警_送料->" + split3[0]);
//        maps.put(185, "超时报警_送料->" + split3[1]);
//        maps.put(186, "超时报警_送料->" + split3[2]);
//        maps.put(187, "超时报警_送料->" + split3[3]);
//        maps.put(188, "超时报警_送料->" + split3[4]);
//        maps.put(189, "超时报警_送料->" + split3[5]);
//        maps.put(190, "超时报警_送料->" + split3[6]);
//        maps.put(191, "超时报警_送料->" + split3[7]);
//        maps.put(192, "超时报警_送料->" + split3[8]);
//        maps.put(193, "超时报警_送料->" + split3[9]);
//        maps.put(194, "超时报警_送料->" + split3[10]);
//        maps.put(195, "超时报警_送料->" + split3[11]);
//        maps.put(196, "超时报警_送料->" + split3[12]);
//        maps.put(197, "超时报警_送料->" + split3[13]);

//        maps.put(200, "报警_产品未到位->" + split4[0]);
//        maps.put(201, "报警_产品未到位->" + split4[1]);
//        maps.put(202, "报警_产品未到位->" + split4[2]);
//        maps.put(203, "报警_产品未到位->" + split4[3]);
//        maps.put(204, "报警_产品未到位->" + split4[4]);
//        maps.put(205, "报警_产品未到位->" + split4[5]);
//        maps.put(206, "报警_产品未到位->" + split4[6]);
//        maps.put(207, "报警_产品未到位->" + split4[7]);
//        maps.put(208, "报警_产品未到位->" + split4[8]);
//        maps.put(209, "报警_产品未到位->" + split4[9]);
//        maps.put(210, "报警_产品未到位->" + split4[10]);
//        maps.put(211, "报警_产品未到位->" + split4[11]);
//        maps.put(212, "报警_产品未到位->" + split4[12]);
//        maps.put(213, "报警_产品未到位->" + split4[13]);

//        String tipsWarn = "请把右升降产品人工取走";
//        maps.put(232, "提示报警-->" + tipsWarn);
    }

}
